﻿<UserControl x:Class="Buttercup.Control.RescaleUIPopupContents"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:bc="clr-namespace:Buttercup.Control" >
	
	<Grid>
		<Rectangle Fill="{Binding Path=DefaultBackground}" Opacity="0.7"
				   MouseLeftButtonDown="OuterPopup_Click" />

		<Border x:Name="mainFrame" Style="{StaticResource SectionFrame}" VerticalAlignment="Center" HorizontalAlignment="Center"
				Background="{Binding Path=DefaultBackground}" BorderBrush="{Binding Path=DefaultForeground}"
				MouseLeftButtonDown="Border_MouseLeftButtonDown">
			<Border.RenderTransform>
				<ScaleTransform ScaleX="1.5" ScaleY="1.5" />
			</Border.RenderTransform>
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition />
					<RowDefinition />
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>

				<TextBlock Grid.ColumnSpan="2" Style="{StaticResource PopupHeading}"
						Text="Change Size" FontSize="38" />

                <bc:MediaButton x:Name="decreaseSizeButton" Style="{StaticResource SquareButton}" Grid.Row="2"
						Click="decreaseSizeButton_Click"
						HorizontalAlignment="Left"
                        GotFocus="SpeakElementOnFocus" LostFocus="Button_LostFocus"
						MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"
						AutomationProperties.Name="Decrease Size"
						AutomationProperties.HelpText="Decrease the size by pressing Shift+J or clicking this button."
						Background="{Binding Path=DefaultBackground}" Foreground="{Binding Path=DefaultForeground}"
						SelectionBackground="{Binding Path=HighlightBackground}" SelectionForeground="{Binding Path=HighlightForeground}"
						FocusBackground="{Binding Path=SelectionBackground}" FocusForeground="{Binding Path=SelectionForeground}"
                        KeyDown="decreaseSizeButton_KeyDown">
                    <ToolTipService.ToolTip>
                        <bc:ExtendedToolTip Content="Decrease the size of the interface elements"></bc:ExtendedToolTip>
                    </ToolTipService.ToolTip>
                    <Path Width="16" Height="16" Stretch="Uniform" Fill="{Binding Path=DefaultForeground}"
							Data="M 0.0,5.5	L 16,5.5	L 16,10.5	L 0.0,10.5 Z"/>
                </bc:MediaButton>

                <bc:MediaSlider x:Name="changeSizeSlider" Grid.Row="2" Grid.Column="1"
						Minimum="10" Maximum="30" SmallChange="1" LargeChange="4"
						MinWidth="200"
						ValueChanged="changeSizeSlider_ValueChanged" Style="{StaticResource RescaleSlider}"
						Background="{Binding Path=DefaultBackground}" Foreground="{Binding Path=DefaultForeground}" BorderBrush="{Binding Path=DefaultForeground}"
						SelectionBackground="{Binding Path=HighlightBackground}" SelectionForeground="{Binding Path=HighlightForeground}"
						FocusBackground="{Binding Path=SelectionBackground}" FocusForeground="{Binding Path=SelectionForeground}"
						AutomationProperties.Name="Change Size" AutomationProperties.HelpText="Use the slider, or the keyboard shortcuts Shift+J and Shift+K to change the size of the buttercup reader." 
						GotFocus="changeSizeSlider_GotFocus"  />

                <bc:MediaButton x:Name="increaseSizeButton" Style="{StaticResource SquareButton}" Grid.Row="2" Grid.Column="2"
						Click="increaseSizeButton_Click"
						HorizontalAlignment="Right"
                        GotFocus="SpeakElementOnFocus" LostFocus="Button_LostFocus"
						MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"
						AutomationProperties.Name="Increase Size"
						AutomationProperties.HelpText="Increase the size by pressing Shift+K or clicking this button."
						Background="{Binding Path=DefaultBackground}" Foreground="{Binding Path=DefaultForeground}"
						SelectionBackground="{Binding Path=HighlightBackground}" SelectionForeground="{Binding Path=HighlightForeground}"
						FocusBackground="{Binding Path=SelectionBackground}" FocusForeground="{Binding Path=SelectionForeground}">
                    <ToolTipService.ToolTip>
                        <bc:ExtendedToolTip Content="Increase the size of the interface elements"></bc:ExtendedToolTip>
                    </ToolTipService.ToolTip>
                    <Path Width="16" Height="16" Stretch="Uniform" Fill="{Binding Path=DefaultForeground}"
							Data="M 0.0,5.5	L 5.5,5.5	L 5.5,0.0	L 10.5,0.0	L 10.5,5.5	L 16,5.5
								L 16,10.5	L 10.5,10.5	L 10.5,16	L 5.5,16	L 5.5,10.5	L 0.0,10.5 Z"/>
                </bc:MediaButton>

                <bc:MediaButton x:Name="closePopupButton" Style="{StaticResource SquareButton}" Grid.Column="2"
						Click="closePopupButton_Click"
						HorizontalAlignment="Right"
                        GotFocus="SpeakElementOnFocus" LostFocus="Button_LostFocus"
						MouseEnter="Button_MouseEnter" MouseLeave="Button_MouseLeave"
						AutomationProperties.Name="Close Popup"
						AutomationProperties.HelpText="Close the popup for resizing the interface by pressing Escape or clicking this button."
						Background="{Binding Path=DefaultBackground}" Foreground="{Binding Path=DefaultForeground}"
						SelectionBackground="{Binding Path=HighlightBackground}" SelectionForeground="{Binding Path=HighlightForeground}"
						FocusBackground="{Binding Path=SelectionBackground}" FocusForeground="{Binding Path=SelectionForeground}"
                        KeyDown="closePopupButton_KeyDown">
                    <ToolTipService.ToolTip>
                        <bc:ExtendedToolTip Content="Close the popup for resizing the interface elements"></bc:ExtendedToolTip>
                    </ToolTipService.ToolTip>
                    <Path Width="13.516" Height="13.5134" Stretch="Fill" Fill="{Binding Path=DefaultForeground}"
							Data="F1 M 313.465,232.534L 311.577,230.65L 306.707,235.519L 301.836,230.65L 299.949,232.534L 304.822,237.406L 299.949,242.276L 301.836,244.163L 306.707,239.292L 311.577,244.163L 313.465,242.276L 308.593,237.406L 313.465,232.534 Z " />
				</bc:MediaButton>

                <!-- Zero size control which is used as the "last" control on the popup
                + If you have focus on the last silverlight control, then 'tab' will tab out into
                the browser (unoverridable by the controls).
                + So we put in this empty control as the "last" silverlight control and just never
                tab to it ever. -->
                <bc:EmptyControl x:Name="PopupNoFocus" Opacity="0" Width="0" Height="0"
									 IsTabStop="True" IsEnabled="True" Visibility="Visible" />

                <Rectangle Grid.Row="1" Grid.ColumnSpan="3" Style="{StaticResource HorizontalSeparator}"
									   Fill="{Binding Path=DefaultForeground}"/>

			</Grid>
		</Border>
	</Grid>
</UserControl>
